import Vue from 'vue'

import Cookies from 'js-cookie'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import Element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/zh-CN'

import '@/styles/index.scss' // global css

import App from './App'
import router from './router'
import store from './store'

import { parseTime } from '@/utils'
import { deepClone } from '@/utils'
import { $get, $post } from '@/utils/request'
import request from '@/utils/request'
Vue.prototype.$get = $get
Vue.prototype.$post = $post
Vue.prototype.$request = request
Vue.prototype.$parseTime = parseTime
Vue.prototype.$deepClone = deepClone

import card from './views/components/card'
import form from './views/components/form'
import table from './views/components/table'
import searchForm from './views/components/searchForm'
import layout from './views/components/layout'
import transfer from './views/components/transfer'
import tableBtns from './views/components/btns_above_table'
import resetConfirmBtn from './views/components/reset_confirm_btn'
import pagination from './views/components/pagination'
import messageBox from './views/components/messageBox'

Vue.component('v-card', card)
Vue.component('v-form', form)
Vue.component('v-table', table)
Vue.component('v-searchForm', searchForm)
Vue.component('v-layout', layout)
Vue.component('v-transfer', transfer)
Vue.component('v-tableBtns', tableBtns)
Vue.component('v-resetConfirmBtn', resetConfirmBtn)
Vue.component('v-pagination', pagination)
Vue.component('v-messageBox', messageBox)

import './icons' // icon
import './permission' // permission control
// import './mock' // simulation data

import * as filters from './filters' // global filters

Vue.use(Element, {
  locale
})

// register global utility filters.
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

Vue.config.performance = true

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
